<!DOCTYPE html>
<html>
<head>
<title>req_assign</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />

<link rel="stylesheet" type="text/css"
	href="/codebase/fonts/font_roboto/roboto.css" />
<link rel="stylesheet" type="text/css" href="/codebase/dhtmlx.css" />
 <script type="text/javascript" src="/codebase/dhtmlx.js" /> 
<style>
div#simpleLog {
	height: 200px;
	font-family: Roboto, Arial, Helvetica;
	font-size: 14px;
	color: #404040;
	overflow: auto;
}

div.my_header div.text_block {
	height: 50px;
	line-height: 44px;
	font-size: 28px;
	color: #199BC6;
	margin-left: 5px;
	padding-left: 200px;
	background-image: url("/common/szsrcb-logo.png");
	background-repeat: no-repeat;
	background-position: center left;
}
</style>
<script>
	var myForm, myGrid,logObj,data,my_form2,formStructure;
	var dhxWins ;
	var customCss = {
		video_bitrate : "validate_magenta",
		video_codec : "validate_orange"
	};
	function doOnLoad() {
		//req_query form setup
		if (myForm) {
			myForm.unload();
			myForm = null;
		}
		myForm = new dhtmlXForm("form_req_query");
		//myForm.loadStruct("/common/testmanager/test_query_mgnt.xml");
		myForm.loadStruct("/test/test_list_mgnt_form_onload","json");
		
		myForm.attachEvent("onButtonClick", function(name) {		
					
			if (name = "query_btn") {
				var params = "?params=" + myForm.getItemValue("req_title")+"," + myForm.getItemValue("create_date_start")+","+myForm.getItemValue("create_date_end")
				+ "," + myForm.getItemValue("req_bill_no")+"," + myForm.getItemValue("test_technical_director")+"," + myForm.getItemValue("test_status");
				//myGrid.clearAll();
				//myGrid.load("req/req_search" + params,callback_load,"json");
				myGrid.clearAndLoad("/test/test_search_for_test_modify_my" + params,callback,"json");
				}
		});
		
		
		
		//grid setup
		if (myGrid) {			
			myGrid.clearAll(true);			
		}
		myGrid = new dhtmlXGridObject("grid_req_list");
		//myGrid.loadStruct("/common/testmanager/req_list.xml");
		myGrid.setImagePath("/codebase/imgs/");

		myGrid.setHeader(",Test ID,需求编号,测试状态,测试项目,测试技术负责人,要求完成时间");
		myGrid.setInitWidths("50,50,150,100,250,150,150");
		myGrid.setColAlign("center,center,left,left,left,left,left");
		myGrid.setColTypes("ra,ro,ro,ro,ro,ro,ro");
		myGrid.setColSorting("str,int,str,str,str,str,str");
		//myGrid.setColumnIds("first,second");
		myGrid.xml.top = "mytop";
		myGrid.xml.row = "./myrow";
		myGrid.setDateFormat("%Y-%m-%d");
		//myGrid.enableAutoWidth(true);
		//myGrid.enableAutoHeight(true);
		myGrid.init();		
		//myGrid.load("/common/testmanager/test_list_test_data.xml", "xml");
		myGrid.attachEvent("onRowSelect",function(rowID,celInd){
		    //alert("The id of the selected row is "+rowID);		    
		    myGrid.cells(rowID,0).setValue("1");
		    
		});
		//open window button setup
		formStructure=null;
		formStructure=[
		               {type:"button",name:"assign_btn",value:"维护测试"}
			               ];
		if (my_form2) {
			my_form2.unload();
			my_form2 = null;
		}		
		my_form2=new dhtmlXForm("form_req_query_btn");
		my_form2.loadStruct(formStructure);
		
		my_form2.attachEvent("onButtonClick", function(name) {		
		
		
			if (name = "assign_btn") {
				var get_row=myGrid.getCheckedRows(0);
				if(get_row==""){
					alert("请先在列表中选择一条记录");
				}
				else{
					createWindow();
				}			
			}
		});
		
		if (dhxWins) {
			dhxWins.unload();
			dhxWins = null;
		}
		
	}
	
	function open_req_assign_wind() {
		//alert("open_req_assign_windows");
		//dhxWins = new dhtmlXWindows();
		//dhxWins.attachViewportTo("form_req_query");
		//createWindow()
		myLayout.cells("a").detachObject(true);
		/*
		myLayout.attachEvent("onContentLoaded", function(id) {
			var ifr = myLayout.cells("a").getFrame();
			doOnLoad();
		});*/
		myLayout.cells("a").attachURL("/test/test_modify_detail", true);
				
	}
	
	function createWindow() {
		//alert("open_createWindow");
		
		var id = "test_modify_window";
		//
		var w = 1000;
		var h = 800;
		var x = 50;
		var y = 50;
		//
		var dhxWins=new dhtmlXWindows();
		dhxWins.createWindow(id, x, y, w, h);
		dhxWins.window(id).setText("维护测试信息");
		
		dhxWins.window(id).denyPark();
		dhxWins.window(id).button("park").hide();
		
		//dhxWins.window(id).attachURL("req_assign_detail");
		var get_row=myGrid.getCheckedRows(0);
		var get_test_id=myGrid.cells(get_row,1).getValue();		
		
		dhxWins.window(id).attachURL("/test/test_modify_detail?test_id="+get_test_id);
		
		
	
	}
	
	

	function doFormValidate() {
		myForm.validate();
	}
	
	var callback=function () {
		//alert("callback");
		
		/*if(arguments[1]=="true"){
			alert("查询成功");	
			window.location.pathname="/";
		}
		else{
			alert("查询失败，错误信息："+arguments[1]);
		}
		*/
	}
</script>
</head>
<body onload="doOnLoad();">
	<table>
		<tr>
			<td>
				<div id="form_req_query" style="padding-left: 100px;"></div>
			</td>
		</tr>
		<tr>
			<td>
				<div id="form_req_list" style="padding-left: 100px;"></div>
				<div id="grid_req_list"
					style="width: 1000px; height: 200px; background-color: white;">
				</div>
			</td>
		</tr>
		<tr>
			<td>
				<div id="form_req_query_btn" style="padding-left: 100px;"></div>
			</td>
		</tr>
		<tr>
			<td>
				<div id="form_req_assign" style="padding-left: 100px;"></div>
			</td>
		</tr>
		
	</table>
</body>
</html>